package com.jinlia.show.modules.wxapp.controller;

import com.jinlia.show.modules.base.model.po.GoodsPO;
import com.jinlia.show.modules.base.wxapp.entity.SearchHis;
import com.jinlia.show.modules.base.model.query.SearchHisQuery;
import com.jinlia.show.modules.base.wxapp.service.SearchHisMapperService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/search")
public class SearchPageController {

    @Autowired
    private SearchHisMapperService searchHisMapperService;

    @PostMapping(value = "/hot")
    private List<SearchHis> hotSearch(@RequestBody SearchHisQuery searchHisQuery) {
        return searchHisMapperService.hotSearch(searchHisQuery);
    }

    @PostMapping(value = "/add")
    private Boolean hotSearch(@RequestBody SearchHis searchHis) {
        return searchHisMapperService.save(searchHis);
    }

    @PostMapping(value = "/goods")
    private List<GoodsPO> goodsSearch(@RequestBody SearchHis searchHis) {
        return searchHisMapperService.goodsSearch(searchHis);
    }

}
